//初始化字段
export function questionnaire(data: any, id: string) {
    let obj = {} as any   //todo 类型注解
    for (let i = 0; i < data.length; i++) {
        switch (data[i].type) {
            case 4:
                if (id === '11' || id === '12') {
                    if (data[i].filterLength) {
                        for (const index in data[i].rowTitle)
                            obj[`${data[i].field}${(parseInt(index) + 1) + data[i].filterLength * data[i].filterIndex}`] = ''
                    }
                    else for (const index in data[i].rowTitle)
                        obj[`${data[i].field}${parseInt(index) + 1}`] = ''

                }
                else if (id === '1')
                    for (const index in data[i].rowTitle)
                        obj[`${data[i].field}_${parseInt(index) + 1}`] = ''
                break;
            case 7:
                obj[data[i].field[0]] = 0,
                    obj[data[i].field[1]] = ''
                break;
            case 3:
                obj[data[i].field] = []
                for (const _index in data[i].ans)
                    obj[data[i].field].push('0')
                break;
            case 14:

                for (let value of data[i].field) {
                    obj[value] = ''
                }
                break;
            case 15:

                for (let value of data[i].field) {
                    obj[value] = ''
                }
                break;
            case 6:
                obj[data[i].field] = []
                break;
            default:
                obj[data[i].field] = ''
        }
    }
    return obj
}